< previous page page_200 next page >

Page 200
            Text1.SetFocus
        ElseIf KeyCode = vbKeyL Then
            Text2.SetFocus
        ElseIf KeyCode = vbKeyS Then
            Combo1.SetFocus
        End If
    End If
End Sub
Note
The
KeyPreview property of the form must be set to True in order for this to work correctly.

As you can see, this feature lets you use only a certain number of letters. You can view the KeyCode constants in the Object Browser to see all of the valid keys that you can use. Run the application and try the different key combinations. You can see that if many different input fields were on the form, this navigation feature would be useful.
Summary..
You have seen that designing forms takes a little more effort than just putting controls on the form. You must understand what the function of each form will be and how you want to present the information to the user. In addition, you have seen how to combine all of the different elements available in Visual Basic to create a form design that gives the user good information about the functions they are performing and a method for navigating to and from the different forms. The menus and toolbars also give users quick access to the application's functions and features without having to remember what keystroke they must make to perform the action.
Q&A
Q How can I use the Windows registry to save information from the application?
A You can access the system registry for the application by using the Visual Basic functions GetSetting and SaveSetting.
Q Are objects in Visual Basic capable of showing ToolTips?
A Most objects that have been created for Visual Basic are capable of displaying ToolTips; however, some objects do not support this feature.
Q Can an MDI parent form display a child form as Modal?
A No, child forms cannot be displayed using the Modal keyword.

 
< previous page page_200 next page >

If you like this book, buy it!